home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Dev / Oberon / source / amiga / ASL.mod < prev    next >
Text File  |  1995-06-29  |  17KB  |  465 lines

  1. (***************************************************************************
  2.  
  3.      $RCSfile: ASL.mod $
  4.   Description: Interface to asl.library
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.8 $
  8.       $Author: fjc $
  9.         $Date: 1995/06/04 23:13:14 $
  10.  
  11.   Includes Release 40.15
  12.  
  13.   (C) Copyright 1989-1993 Commodore-Amiga Inc.
  14.   (C) Copyright 1989-1990 Charlie Heath
  15.       All Rights Reserved
  16.  
  17.   Oberon-A interface Copyright © 1994-1995, Frank Copeland.
  18.   This file is part of the Oberon-A Interface.
  19.   See Oberon-A.doc for conditions of use and distribution.
  20.  
  21. ***************************************************************************)
  22.  
  23. <* STANDARD- *>
  24.  
  25. MODULE [2] ASL;
  26.  
  27. IMPORT
  28.   SYS := SYSTEM, Kernel, e := Exec, u := Utility, gfx := Graphics,
  29.   w := Workbench, s := Sets;
  30.  
  31. (*
  32. **      $VER: asl.h 38.5 (5.1.93)
  33. **
  34. **      ASL library structures and constants
  35. *)
  36.  
  37. (*****************************************************************************)
  38.  
  39. CONST
  40.  
  41.   aslName *  = "asl.library";
  42.   aslTag *   = u.user+080000H;
  43.  
  44.  
  45. (*****************************************************************************)
  46.  
  47. CONST
  48.  
  49. (* Types of requesters known to ASL, used as arguments to AllocAslRequest() *)
  50.   fileRequest * = 0;
  51.   fontRequest * = 1;
  52.   screenModeRequest * = 2;
  53.  
  54. (************************************************************************)
  55. CONST
  56. (*
  57.  * common tag arguments
  58.  *)
  59.  
  60.  
  61. (* Window control *)
  62.   window         * = aslTag+2;   (* Parent window                    *)
  63.   screen         * = aslTag+40;  (* Screen to open on if no window   *)
  64.   pubScreenName  * = aslTag+41;  (* Name of public screen            *)
  65.   privateIDCMP   * = aslTag+42;  (* Allocate private IDCMP?          *)
  66.   intuiMsgFunc   * = aslTag+70;  (* Function to handle IntuiMessages *)
  67.   sleepWindow    * = aslTag+43;  (* Block input in ASLFO_WindoU?     *)
  68.   userData       * = aslTag+52;  (* What to put in fo_UserData       *)
  69.  
  70. (* Text display *)
  71.   textAttr       * = aslTag+51;  (* Text font to use for gadget text *)
  72.   locale         * = aslTag+50;  (* Locale ASL should use for text   *)
  73.   titleText      * = aslTag+1;   (* Title of requester               *)
  74.   positiveText   * = aslTag+18;  (* Positive gadget text             *)
  75.   negativeText   * = aslTag+19;  (* Negative gadget text             *)
  76.  
  77. (* Initial settings *)
  78.   initialLeftEdge * = aslTag+3;   (* Initial requester coordinates    *)
  79.   initialTopEdge  * = aslTag+4;
  80.   initialWidth    * = aslTag+5;   (* Initial requester dimensions     *)
  81.   initialHeight   * = aslTag+6;
  82.  
  83. (* Filtering *)
  84.   filterFunc     * = aslTag+49;  (* Function to filter fonts         *)
  85.   hookFunc       * = aslTag+7;   (* Combined callback function       *)
  86.  
  87. (*
  88. ** Requester base type, for type compatibility between requester
  89. ** structures
  90. *)
  91.  
  92. TYPE
  93.  
  94.   ASLRequesterPtr * = POINTER TO ASLRequester;
  95.   ASLRequester * = RECORD END;
  96.  
  97. (*****************************************************************************
  98.  *
  99.  * ASL File Requester data structures and constants
  100.  *
  101.  * This structure must only be allocated by asl.library amd is READ-ONLY!
  102.  * Control of the various fields is provided via tags when the requester
  103.  * is created with AllocAslRequest() and when it is displayed via
  104.  * AslRequest()
  105.  *)
  106.  
  107. TYPE
  108.  
  109.   FileRequesterPtr * = POINTER TO FileRequester;
  110.   FileRequester * = RECORD (ASLRequester)
  111.     reserved0 - : ARRAY 4 OF e.UBYTE;
  112.     file -      : e.LSTRPTR;            (* Contents of File gadget on exit    *)
  113.     drawer -    : e.LSTRPTR;            (* Contents of Drawer gadget on exit  *)
  114.     reserved1 - : ARRAY 10 OF e.UBYTE;
  115.     leftEdge -  : INTEGER;              (* Coordinates of requester on exit   *)
  116.     topEdge -   : INTEGER;
  117.     width -     : INTEGER;
  118.     height -    : INTEGER;
  119.     reserved2 - : ARRAY 2 OF e.UBYTE;
  120.     numArgs -   : LONGINT;              (* Number of files selected           *)
  121.     argList -   : w.WBArgumentsPtr;     (* List of files selected     *)
  122.     userData -  : e.APTR;               (* You can store your own data here   *)
  123.     reserved3 - : ARRAY 8 OF e.UBYTE;
  124.     pattern -   : e.LSTRPTR;            (* Contents of Pattern gadget on exit *)
  125.   END;
  126.  
  127. CONST
  128.  
  129. (* File requester tag values, used by AllocAslRequest() and AslRequest() *)
  130.  
  131. (* Window control *)
  132.   (* see common tags above *)
  133.  
  134. (* Text display *)
  135.   (* see common tags above *)
  136.  
  137. (* Initial settings *)
  138.   (* see common tags above *)
  139.   initialFile *     = aslTag+8;   (* Initial contents of File gadget  *)
  140.   initialDrawer *   = aslTag+9;   (* Initial contents of Drawer gadg. *)
  141.   initialPattern *  = aslTag+10;  (* Initial contents of Pattern gadg.*)
  142.  
  143. (* Options *)
  144.   flags1 *          = aslTag+20;  (* Option flags                     *)
  145.   flags2 *          = aslTag+22;  (* Additional option flags          *)
  146.   doSaveMode *      = aslTag+44;  (* Being used for saving?           *)
  147.   doMultiSelect *   = aslTag+45;  (* Do multi-select?                 *)
  148.   doPatterns *      = aslTag+46;  (* Display a Pattern gadget?        *)
  149.  
  150. (* Filtering *)
  151.   (* see common tags above *)
  152.   drawersOnly *     = aslTag+47;  (* Don't display files?             *)
  153.   rejectIcons *     = aslTag+60;  (* Display .info files?             *)
  154.   rejectPattern *   = aslTag+61;  (* Don't display files matching pat *)
  155.   acceptPattern *   = aslTag+62;  (* Accept only files matching pat   *)
  156.   filterDrawers *   = aslTag+63;  (* Also filter drawers with patterns*)
  157.  
  158. (* Flag bits for the flags1 tag *)
  159.   frFilterFunc *      = 7;
  160.   frIntuiFunc *       = 6;
  161.   frDoSaveMode *      = 5;
  162.   frPrivateIDCMP *    = 4;
  163.   frDoMultiSelect *   = 3;
  164.   frDoPatterns *      = 0;
  165.  
  166. (* Flag bits for the flags2 tag *)
  167.   frDrawersOnly *     = 0;
  168.   frFilterDrawers *   = 1;
  169.   frRejectIcons *     = 2;
  170.  
  171.  
  172. (*****************************************************************************
  173.  *
  174.  * ASL Font Requester data structures and constants
  175.  *
  176.  * This structure must only be allocated by asl.library amd is READ-ONLY!
  177.  * Control of the various fields is provided via tags when the requester
  178.  * is created with AllocAslRequest() and when it is displayed via
  179.  * AslRequest()
  180.  *)
  181.  
  182. TYPE
  183.  
  184.   FontRequesterPtr * = POINTER TO FontRequester;
  185.   FontRequester * = RECORD (ASLRequester)
  186.     reserved0 - : ARRAY 8 OF e.UBYTE;
  187.     attr -      : gfx.TextAttr;  (* Returned TextAttr                *)
  188.     frontPen -  : SHORTINT;      (* Returned front pen               *)
  189.     backPen -   : SHORTINT;      (* Returned back pen                *)
  190.     drawMode -  : s.SET8;        (* Returned drawing mode            *)
  191.     reserved1 - : e.UBYTE;
  192.     userData -  : e.APTR;        (* You can store your own data here *)
  193.     leftEdge -  : INTEGER;       (* Coordinates of requester on exit *)
  194.     topEdge -   : INTEGER;
  195.     width -     : INTEGER;
  196.     height -    : INTEGER;
  197.     tAttr -     : gfx.TTextAttr; (* Returned TTextAttr               *)
  198.   END;
  199.  
  200. CONST
  201.  
  202. (* Font requester tag values, used by AllocAslRequest() and AslRequest() *)
  203.  
  204. (* Window control *)
  205.   (* see common tags above *)
  206.  
  207. (* Text display *)
  208.   (* see common tags above *)
  209.  
  210. (* Initial settings *)
  211.   (* see common tags above *)
  212.   initialName *     = aslTag+10;  (* Initial contents of Name gadget  *)
  213.   initialSize *     = aslTag+11;  (* Initial contents of Size gadget  *)
  214.   initialStyle *    = aslTag+12;  (* Initial font style               *)
  215.   initialFlags *    = aslTag+13;  (* Initial font flags for TextAttr  *)
  216.   initialFrontPen * = aslTag+14;  (* Initial front pen                *)
  217.   initialBackPen *  = aslTag+15;  (* Initial back pen                 *)
  218.   initialDrawMode * = aslTag+59;  (* Initial draw mode                *)
  219.  
  220. (* Options *)
  221.   flags *           = aslTag+20;  (* Option flags                     *)
  222.   doFrontPen *      = aslTag+44;  (* Display Front color selector?    *)
  223.   doBackPen *       = aslTag+45;  (* Display Back color selector?     *)
  224.   doStyle *         = aslTag+46;  (* Display Style checkboxes?        *)
  225.   doDrawMode *      = aslTag+47;  (* Display DrawMode cycle gadget?   *)
  226.  
  227. (* Filtering *)
  228.   fixedWidthOnly *  = aslTag+48;  (* Only allow fixed-width fonts?    *)
  229.   minHeight *       = aslTag+16;  (* Minimum font height to display   *)
  230.   maxHeight *       = aslTag+17;  (* Maximum font height to display   *)
  231.   maxFrontPen *     = aslTag+66;  (* Max # of colors in front palette *)
  232.   maxBackPen *      = aslTag+67;  (* Max # of colors in back palette  *)
  233.  
  234. (* Custom additions *)
  235.   modeList *        = aslTag+21;  (* Substitute list for drawmodes    *)
  236.   frontPens *       = aslTag+64;  (* Color table for front pen palette*)
  237.   backPens *        = aslTag+65;  (* Color table for back pen palette *)
  238.  
  239. (* Flag bits for foFlags tag *)
  240.   foDoFrontPen *     = 0;
  241.   foDoBackPen *      = 1;
  242.   foDoStyle *        = 2;
  243.   foDoDrawMode *     = 3;
  244.   foFixedWidthOnly * = 4;
  245.   foPrivateIDCMP *   = 5;
  246.   foIntuiFunc *      = 6;
  247.   foFilterFunc *     = 7;
  248.  
  249. (*****************************************************************************
  250.  *
  251.  * ASL Screen Mode Requester data structures and constants
  252.  *
  253.  * This structure must only be allocated by asl.library and is READ-ONLY!
  254.  * Control of the various fields is provided via tags when the requester
  255.  * is created with AllocAslRequest() and when it is displayed via
  256.  * AslRequest()
  257.  *)
  258.  
  259. TYPE
  260.  
  261.   ScreenModeRequesterPtr * = POINTER TO ScreenModeRequester;
  262.   ScreenModeRequester * = RECORD (ASLRequester)
  263.     displayID -     : e.ULONG;  (* Display mode ID                  *)
  264.     displayWidth -  : e.ULONG;  (* Width of display in pixels       *)
  265.     displayHeight - : e.ULONG;  (* Height of display in pixels      *)
  266.     displayDepth -  : e.UWORD;  (* Number of bit-planes of display  *)
  267.     overscanType -  : e.UWORD;  (* Type of overscan of display      *)
  268.     autoScroll -    : BOOLEAN;  (* Display should auto-scroll?      *)
  269.     pad1            : SHORTINT;
  270.  
  271.     bitMapWidth -   : e.ULONG;  (* Used to create your own BitMap   *)
  272.     bitMapHeight -  : e.ULONG;
  273.  
  274.     leftEdge -      : INTEGER;  (* Coordinates of requester on exit *)
  275.     topEdge -       : INTEGER;
  276.     width -         : INTEGER;
  277.     height -        : INTEGER;
  278.  
  279.     infoOpened -    : BOOLEAN;  (* Info window opened on exit?      *)
  280.     pad2            : SHORTINT;
  281.     infoLeftEdge -  : INTEGER;  (* Last coordinates of Info window  *)
  282.     infoTopEdge -   : INTEGER;
  283.     infoWidth -     : INTEGER;
  284.     infoHeight -    : INTEGER;
  285.  
  286.     userData -      : e.APTR;   (* You can store your own data here *)
  287.   END;
  288.  
  289. (* An Exec list of custom modes can be added to the list of available modes.
  290.  * The DimensionInfo structure must be completely initialized, including the
  291.  * Header. See <graphics/displayinfo.h>. Custom mode ID's must be in the range
  292.  * 0xFFFF0000..0xFFFFFFFF. Regular properties which apply to your custom modes
  293.  * can be added in the dn_PropertyFlags field. Custom properties are not
  294.  * allowed.
  295.  *)
  296.  
  297.   DisplayModePtr * = POINTER TO DisplayMode;
  298.   DisplayMode * = RECORD (e.NodeBase)
  299.     node *          : e.Node;            (* see ln_Name           *)
  300.     dimensionInfo * : gfx.DimensionInfo; (* mode description      *)
  301.     propertyFlags * : s.SET32;           (* applicable properties *)
  302.   END;
  303.  
  304. CONST
  305.  
  306. (* ScreenMode requester tag values, used by AllocAslRequest() and AslRequest() *)
  307.  
  308. (* Window control *)
  309.   (* see common tags above *)
  310.  
  311. (* Text display *)
  312.   (* see common tags above *)
  313.  
  314. (* Initial settings *)
  315.   (* see common tags above *)
  316.   initialDisplayID * = aslTag+100;      (* Initial display mode id     *)
  317.   initialDisplayWidth * = aslTag+101;   (* Initial display width       *)
  318.   initialDisplayHeight * = aslTag+102;  (* Initial display height      *)
  319.   initialDisplayDepth * = aslTag+103;   (* Initial display depth       *)
  320.   initialOverscanType * = aslTag+104;   (* Initial type of overscan    *)
  321.   initialAutoScroll * = aslTag+105;     (* Initial autoscroll setting  *)
  322.   initialInfoOpened * = aslTag+106;     (* Info wndw initially opened? *)
  323.   initialInfoLeftEdge * = aslTag+107;   (* Initial Info window coords. *)
  324.   initialInfoTopEdge * = aslTag+108;
  325.  
  326. (* Options *)
  327.   doWidth *         = aslTag+109;       (* Display Width gadget?           *)
  328.   doHeight *        = aslTag+110;       (* Display Height gadget?          *)
  329.   doDepth *         = aslTag+111;       (* Display Depth gadget?           *)
  330.   doOverscanType *  = aslTag+112;       (* Display Overscan Type gadget?   *)
  331.   doAutoScroll *    = aslTag+113;       (* Display AutoScroll gadget?      *)
  332.  
  333. (* Filtering *)
  334.   smPropertyFlags *   = aslTag+114;       (* Must have these Property flags  *)
  335.   smPropertyMask *    = aslTag+115;       (* Only these should be looked at  *)
  336.   smMinWidth *        = aslTag+116;       (* Minimum display width to allow  *)
  337.   smMaxWidth *        = aslTag+117;       (* Maximum display width to allow  *)
  338.   smMinHeight *       = aslTag+118;       (* Minimum display height to allow *)
  339.   smMaxHeight *       = aslTag+119;       (* Maximum display height to allow *)
  340.   smMinDepth *        = aslTag+120;       (* Minimum display depth           *)
  341.   smMaxDepth *        = aslTag+121;       (* Maximum display depth           *)
  342.   smFilterFunc *      = aslTag+122;       (* Function to filter mode id's    *)
  343.  
  344. (* Custom additions *)
  345.   customSMList *    = aslTag+123;       (* Exec list of struct DisplayMode *)
  346.  
  347.  
  348. (*****************************************************************************
  349.  *
  350.  * Obsolete ASL definitions, here for source code compatibility only.
  351.  * Please do NOT use in new code.
  352.  *
  353.  *)
  354.  
  355. CONST
  356.  
  357.   fonFrontColor * = 0;
  358.   fonBackColor  * = 1;
  359.   fonStyles     * = 2;
  360.   fonDrawMode   * = 3;
  361.   fonFixedWidth * = 4;
  362.   fonNewIDCMP   * = 5;
  363.   fonDoMsgFunc  * = 6;
  364.   fonDoWildFunc * = 7;
  365.  
  366.   doWildFunc   * = frFilterFunc;
  367.   doMsgFunc    * = frIntuiFunc;
  368.   save         * = frDoSaveMode;
  369.   newIDCMP     * = frPrivateIDCMP;
  370.   multiSelect  * = frDoMultiSelect;
  371.   patGad       * = frDoPatterns;
  372.   noFiles      * = frDrawersOnly;
  373.  
  374.   aslDummy    * = aslTag;
  375.  
  376.   hail        * = aslDummy+1;    (* Hailing text follows              *)
  377.   leftEdge    * = aslDummy+3;    (* Initialize LeftEdge               *)
  378.   topEdge     * = aslDummy+4;    (* Initialize TopEdge                *)
  379.   width       * = aslDummy+5;
  380.   height      * = aslDummy+6;
  381.  
  382. (* Tags specific to file request                                             *)
  383.   file        * = aslDummy+8;    (* Initial name of file follows      *)
  384.   dir         * = aslDummy+9;    (* Initial string of filerequest dir *)
  385.  
  386. (* Tags specific to font request                                             *)
  387.   fontName    * = aslDummy+10;   (* Initial font name                 *)
  388.   fontHeight  * = aslDummy+11;   (* Initial font height               *)
  389.   fontStyles  * = aslDummy+12;   (* Initial font styles               *)
  390.   fontFlags   * = aslDummy+13;   (* Initial font flags for textattr   *)
  391.   frontPen    * = aslDummy+14;   (* Initial frontpen color            *)
  392.   backPen     * = aslDummy+15;   (* Initial backpen color             *)
  393.  
  394.   okText      * = aslDummy+18;   (* Text displayed in OK gadget       *)
  395.   cancelText  * = aslDummy+19;   (* Text displayed in CANCEL gadget   *)
  396.   funcFlags   * = aslDummy+20;   (* Function flags, depend on request *)
  397.  
  398.   extFlags1   * = aslDummy+22;   (* For passing extended FIL1F flags   *)
  399.  
  400.   pattern     * = fontName;      (* File requester pattern string     *)
  401.  
  402. (******** END of ASL Tag values *****************************************)
  403.  
  404. CONST
  405.  
  406. (** --- Library Base variable -------------------------------------------- *)
  407.  
  408. VAR
  409.  
  410.   base *, asl * : e.LibraryPtr;
  411.  
  412.  
  413. (** --- Library Functions ------------------------------------------------ *)
  414.  
  415. (*
  416. **      $VER: asl_protos.h 38.3 (19.3.92)
  417. *)
  418.  
  419. (*--- functions in V36 or higher (distributed as Release 2.0) ---*)
  420.  
  421. (* OBSOLETE -- Please use the generic requester functions instead *)
  422.  
  423. PROCEDURE AllocFileRequest* [base,-30] ()
  424.   : FileRequesterPtr;
  425. PROCEDURE FreeFileRequest* [base,-36]
  426.   ( fileReq [8] : FileRequesterPtr );
  427. PROCEDURE RequestFile* [base,-42]
  428.   ( fileReq [8] : FileRequesterPtr )
  429.   : BOOLEAN;
  430. PROCEDURE AllocAslRequest* [base,-48]
  431.   ( type    [0] : e.ULONG;
  432.     tagList [8] : ARRAY OF u.TagItem )
  433.   : ASLRequesterPtr;
  434. PROCEDURE AllocAslRequestTags* [base,-48]
  435.   ( type    [0]   : e.ULONG;
  436.     tagList [8].. : u.Tag )
  437.   : ASLRequesterPtr;
  438. PROCEDURE FreeAslRequest* [base,-54]
  439.   ( request [8] : ASLRequesterPtr );
  440. PROCEDURE AslRequest* [base,-60]
  441.   ( request [8] : ASLRequesterPtr;
  442.     tagList [9] : ARRAY OF u.TagItem )
  443.   : BOOLEAN;
  444. PROCEDURE AslRequestTags* [base,-60]
  445.   ( request [8]   : ASLRequesterPtr;
  446.     tagList [9].. : u.Tag )
  447.   : BOOLEAN;
  448.  
  449. (*--- Library Base variable --------------------------------------------*)
  450.  
  451. <*$LongVars-*>
  452.  
  453. (*------------------------------------*)
  454. PROCEDURE* [0] CloseLib (VAR rc : LONGINT);
  455.  
  456. BEGIN (* CloseLib *)
  457.   IF base # NIL THEN e.CloseLibrary (base) END
  458. END CloseLib;
  459.  
  460. BEGIN
  461.   base := e.OpenLibrary (aslName, e.libraryMinimum);
  462.   IF base # NIL THEN Kernel.SetCleanup (CloseLib) END;
  463.   asl := base
  464. END ASL.
  465.